Structured Data

What is structured data? Structured data is any set of data that is organized and structured in a particular way on a webpage. In the case of SEO, structured data is organized and tagged with specific groups of text that help search engines understand the context of that information and can return accurate results to searchers.

Structured Data is Google's (and so therefore all web developers') term for machine readable data embedded in a web page.

There are a few different standards of Structured Data each with their own techniques, benefits and disadvantages.

Microformats is most backward compatible and standards compliant but has limited vocabulary. Microdata is the current WHATWG recommendation and has been included as part of the HTML 5 specifications. RDFa and JSON-LD have the flexibility of XML but RDFa uses non-standard attributes and JSON-LD duplicates data into an almost separate document.

Google recommends that only one style of Structured Data be used. That said, Google doesn't actually include Microformats in their definition of Structured Data. As such, we use Microformats and Microdata together on the same page.

JSON-LD

Style

Machine readable data is stored as a JSON object in a 'script' element.

Example

Test HTML code at Schema Markup Validator

<script type="application/ld+json"> { "@context": { "name": "http://xmlns.com/foaf/0.1/name", "homepage": { "@id": "http://xmlns.com/foaf/0.1/workplaceHomepage", "@type": "@id" }, "Person": "http://xmlns.com/foaf/0.1/Person" }, "@id": "https://me.example.com", "@type": "Person", "name": "John Smith", "homepage": "https://www.example.com/" } </script>

{ "@type": "http://xmlns.com/foaf/0.1/Person", "@id": "https://me.example.com/", "http://xmlns.com/foaf/0.1/name": "John Smith", "http://xmlns.com/foaf/0.1/workplaceHomepage": "https://www.example.com/" }

Benefits

Maps to RDF so can implement any vocabulary.

Disadvantages

Not human readable. Duplicates data in the page or. Maintains separation of human and computer readable data.

Microdata

Style

Machine readable attributes are added to HTML elements.

Example

Test HTML code at Schema Markup Validator

<section itemscope itemtype="http://schema.org/Person"> <p>Hello, my name is <span itemprop="name">John Doe</span>, I am a <span itemprop="jobTitle">graduate research assistant</span> at the <span itemprop="affiliation">University of Dreams</span>.</p> <p>My friends call me <span itemprop="additionalName">Johnny</span>.</p> <p>You can visit my homepage at <a href="http://www.example.com/~JohnnyD" itemprop="url">www.example.com/~JohnnyD</a>.</p> <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> <p>I live at <span itemprop="streetAddress">1234 Peach Drive</span>, <span itemprop="addressLocality">Warner Robins</span>, <span itemprop="addressRegion">Georgia</span>.</p> </span> </section>

Hello, my name is John Doe, I am a graduate research assistant at the University of Dreams. My friends call me Johnny. You can visit my homepage at www.example.com/~JohnnyD. I live at 1234 Peach Drive, Warner Robins, Georgia.

{ "@type": "Person", "name": "John Doe", "jobTitle": "graduate research assistant", "additionalName": "Johnny", "url": "http://www.example.com/~JohnnyD" "affiliation": { "@type": "Organization", "name": "University of Dreams" }, "address": { "@type": "PostalAddress", "streetAddress": "1234 Peach Drive", "addressLocality": "Warner Robins", "addressRegion": "Georgia" } }

Benefits

Can implement any vocabulary, often from schema.org.

Disadvantages

Attributes are not compatible with prior versions of (X)HTML.

Microformats

Style

Using a combination of existing HTML Semantic Elements, Design Patterns, attributes and classnames.

Example

Test HTML code at Microformats Parser

<address class="adr h-adr"> <p class="label p-label">Head Office</p> <p class="street-address p-street-address">11 Seymour Place</p> <p class="extended-address p-extended-address">Office 1</p> <p class="locality p-locality">Canterbury</p> <p class="region">Kent</p> <p class="postal-code p-postal-code">CT1 3SF</p> <p class="country-name p-country-name">United Kingdom</p> <p class="geo h-geo">Canterbury: <span class="latitude p-latitude">51.2718932</span>; <span class="longitude p-longitude">1.0672116</span>, <span class="p-altitude">5</span></p> <p class="post-office-box p-post-office-box">P.O. Box 2026943</p> </address>

Head Office 11 Seymour Place Office 1 Canterbury Kent CT1 3SF United Kingdom Canterbury: 51.2718932; 1.0672116, 5 P.O. Box 2026943

{ "type": [ "h-adr" ], "properties": { "label": [ "Head Office" ], "street-address": [ "11 Seymour Place" ], "extended-address": [ "Office 1" ], "locality": [ "Canterbury" ], "postal-code": [ "CT1 3SF" ], "country-name": [ "United Kingdom" ], "post-office-box": [ "P.O. Box 2026943" ] }, "children": [ { "type": [ "h-geo" ], "properties": { "latitude": [ "51.2718932" ], "longitude": [ "1.0672116" ], "altitude": [ "5" ] } } ] }

Benefits

Well authored HTML is very simple to markup.

Disadvantages

Limited vocabularies.

RDFa

Style

Elements are annotated with XML Namespaces and Attributes.

Example

Schema Markup Validator

<div xmlns:dc="http://purl.org/dc/elements/1.1/" about="http://www.example.com/books/wikinomics"> <span property="dc:title">Wikinomics</span> <span property="dc:creator">Don Tapscott</span> <span property="dc:date">2006-10-01</span> </div>

Wikinomics Don Tapscott 2006-10-01

{ "@type": "Unspecified Type", "@id": "http://www.example.com/books/wikinomics", "http://purl.org/dc/elements/1.1/title": "Wikinomics", "http://purl.org/dc/elements/1.1/creator": "Don Tapscott", "http://purl.org/dc/elements/1.1/date": "2006-10-01" }

Benefits

Turns human readable HTML into machine readable XML.

Disadvantages

RDFa attributes are not valid HTML and seem to better suited to XHTML.

To Do

Furhter Reading